import paramiko


hostname = '172.16.0.12'
username = 'root'
password = '111111'
port = 22

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname,22,'root',password)
stdin,stdout,stder = ssh.exec_command('df -h')

f0 = stdout.read()
f = open('tmp\\1.txt','wb')
f.write(f0)
f.close()

ssh.close()
